home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: hierarchy_test.java,v 1.11 1996/10/03 19:46:51 hudson Exp $
- * $Author: hudson $
- */
-
- package sub_arctic.test;
-
- import sub_arctic.lib.*;
- import sub_arctic.output.*;
- import sub_arctic.input.*;
- import sub_arctic.constraints.std_function;
-
- import java.awt.Font;
-
- public class hierarchy_test extends interactor_applet {
- static String[] car_data= { "Cars", "Porsche", "Mercedes" , "Ferrari",
- "Volvo","Saab", "Lexus", "Infinity" ,
- "Jaguar", "Rolls Royce", "Audi"};
- static String[] mercedes={"300CE", "560SEL", "520SL", "420SEL", "340C"};
- static String[] porche={"911", "911 carrera", "944", "928s", "959", "911"};
- static String[] rolls={"Left Hand Drive", "Right Hand Drive"};
- static String[] convert={"Hard top", "Convertible"};
- public void build_ui(base_parent_interactor top) {
- int i,j;
- String s;
- interactor item,tmp;
- Font font=new Font("Helvetica",Font.BOLD, 16);
- int object_width=150;
- panner p;
-
- /* make a manager */
- hierarchy_parent mgr=new hierarchy_parent(0,0);
- mgr.open();
-
- /* setup the panner */
- p=new panner(mgr);
- /* want to force the scrollbars? */
- /* p.set_force_scrollbars(true); */
- p.set_w_constraint(std_function.offset(PARENT.X2(), 0));
- p.set_h_constraint(std_function.offset(PARENT.Y2(),0));
-
- /* put the panner in the toplevel */
- top.add_child(p);
- for (i=0; i<car_data.length; ++i) {
- s=car_data[i];
- if (s.equals("Porsche")) {
- /* make a submanager */
- item=new hierarchy_parent(0,0);
- ((hierarchy_parent)item).
- set_special_child(new label(s,object_width, font));
- for (j=0; j<porche.length; ++j) {
- item.add_child(new label(porche[j],object_width, font));
- }
- } else {
- /* make submanager */
- if (s.equals("Mercedes")) {
- item=new hierarchy_parent(0,0);
- ((hierarchy_parent)item).
- set_special_child(new label(s,object_width, font));
- for (j=0; j<mercedes.length; ++j) {
- /* final level of indentation! hard top or convertible? */
- if (mercedes[j].equals("520SL")) {
- tmp=new hierarchy_parent(0,0);
- ((hierarchy_parent)tmp).
- set_special_child(new label(mercedes[j],
- object_width,font));
- tmp.add_child(new label(convert[0],object_width,font));
- tmp.add_child(new label(convert[1],object_width,font));
- item.add_child(tmp);
- } else {
- item.add_child(new label(mercedes[j],object_width, font));
- }
- }
- } else {
- /* possible rolls */
- if (s.equals("Rolls Royce")) {
- item=new hierarchy_parent(0,0);
- ((hierarchy_parent)item).
- set_special_child(new label(s, object_width,font));
- for (j=0; j<rolls.length; ++j) {
- item.add_child(new label(rolls[j],object_width,font));
- }
- } else {
- /* base case.. no submenu ... but might be first*/
- item=new label(s,object_width, font);
- }
- }
- }
- /* might be first child */
- if (s.equals("Cars")) {
- mgr.set_special_child(item);
- } else {
- mgr.add_child(item);
- }
- }
- }
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-